<template>
  <div class="account-box page" ref="webview">
    <div ref="wrapper">
      <van-nav-bar title="账户绑定" class="bg_white" left-arrow @click-left="$router.go(-1)" />
      <div class="content">
        <van-field v-model="form.memberNo" label="帐号" input-align="right" clearable placeholder="请输入剑龙帐号" />
        <div class="exit">
          <van-button class="btn" :loading="isLoading" @click.native="submitAddress">绑定</van-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'accountBinding',
  data () {
    return {
      form: {},
      isLoading: false
    };
  },
  methods: {
    submitAddress () {
      if (!this.form.memberNo) {
        this.$toast('帐号不能为空');
        return;
      }
      this.isLoading = true;
      this.$API.user.bindJl(this.form).then(res => {
        if (!res.code) {
          this.isLoading = false;
          this.$toast('绑定成功');
        } else {
          this.isLoading = false;
        }
      }).catch((res) => {
        this.isLoading = false;
      });
    }
  }
};
</script>
<style lang="less" scoped>
.account-box {
  .content {
    .c-1 {
      color: #917eff;
    }
    margin-top: 30px;
    .exit {
      padding: 50px;
      .btn {
        width: 100%;
        height: 98px;
        border-radius: 98px;
        font-size: 32px;
        line-height: 98px;
        color: #125dff;
      }
    }
  }
}
</style>
